<!doctype html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

	<head>
		<meta charset="utf-8">
		<title>系统管理-公开课列表</title>
		<link href="../c/base.css" rel="stylesheet" type="text/css">
		<link href="../c/toefl.css" rel="stylesheet" type="text/css">
		<link href="../c/bootstrap.min.css" rel="stylesheet" type="text/css">
		<script type="text/javascript" src="../j/jquery-2.1.0.js"></script>
		<script type="text/javascript" src="../j/bootstrap.min.js"></script>
		<script type="text/javascript" src="../j/lrtk.js"></script>
		<link href="../j/ligerUI/skins/Aqua/css/ligerui-dialog.css" rel="stylesheet" type="text/css" />
		<script src="../j/ligerUI/js/core/base.js" type="text/javascript"></script>
		<script src="../j/ligerUI/js/plugins/ligerDialog.js" type="text/javascript"></script>
		<script src="../j/ligerUI/js/plugins/ligerDrag.js" type="text/javascript"></script>
		<script src="../j/ligerUI/js/plugins/ligerResizable.js" type="text/javascript"></script>

		<script type="text/javascript" th:inline="none">
			$(function(){
				var boxs = $("input[type='checkbox'][id^='box_']");


				$("tr[id^='data_']").hover(function(){
					$(this).css("backgroundColor","#eeccff");
				},function(){
					$(this).css("backgroundColor","#ffffff");
				});

				$("#checkAll").click(function() {
					boxs.prop("checked", this.checked);
				});

				$("#delete").click(function(){
					/** 获取到用户选中的复选框  */
					var checkedBoxs = boxs.filter(":checked");
					if(checkedBoxs.length < 1){
						$.ligerDialog.error("请选择一门需要的公开课！");
					}else{
						var ids = checkedBoxs.map(function(){
							return this.value;
						})

						$.ligerDialog.confirm("确认要删除吗?","删除公开课",function(r){
							if(r){
								window.location = "deleteClassInfos?classId=" + ids.get();
							}
						});
					}
				});

				$("#close").click(function(){
					/** 获取到用户选中的复选框  */
					var checkedBoxs = boxs.filter(":checked");
					if(checkedBoxs.length < 1){
						$.ligerDialog.error("请选择一门要关闭的公开课！");
					}else{
						var ids = checkedBoxs.map(function(){
							return this.value;
						})

						$.ligerDialog.confirm("确认要关闭吗?","关闭公开课",function(r){
							if(r){
								window.location = "closeClassInfo?classId=" + ids.get();
							}
						});
					}
				});

				$("#getok").click(function(){
					/** 获取到用户选中的复选框  */
					var checkedBoxs = boxs.filter(":checked");
					if(checkedBoxs.length < 1){
						$.ligerDialog.error("请选择一门需要恢复的公开课！");
					}else{
						var ids = checkedBoxs.map(function(){
							return this.value;
						});

						$.ligerDialog.confirm("确认要恢复吗?","恢复公开课",function(r){
							if(r){
								window.location ="getOkClassInfo?classId=" + ids.get();
							}
						});
					}
				})
			})
			function page(pageNum) {
				$("#pageNum").val(pageNum);
				$("#pageForm").submit();
			}
		</script>
	</head>

	<body>
		<div class="openMenu">
			
		</div>
		<div class="doc1180 paddingT20 fn-clear container">
			<div>
                <!--查询区-->
				<form action="queryClassInforAllAdmin" class="form-inline" id="pageForm">
					<div class="form-group">
						<label for="exampleInputName2">课程名称</label>
						<input type="text" class="form-control" id="exampleInputName2" name="classTitle" placeholder="请输入课程名称">
					</div>
					<div class="form-group">
						<label for="">讲师</label>
						<select class="form-control" name="classInfor.teacherId">
                            <option value="" >--请选择讲师--</option>
							<option th:each="ts:${session.teachers}" th:value="${ts.getTeacher_id()}">[[${ts.user_name}]]</option>
						</select>
					</div>
					<div class="form-group">
						<label for="">课程类别</label>
						<select class="form-control" name="classType">
                            <option value="" readonly="readonly">--请选择课程类别--</option>
							<option th:each="ct:${session.classTypes}" th:value="${ct.typeId}">[[${ct.typeName}]]</option>
						</select>
					</div>
					<!--pageNum值隐藏域-->
					<input type="hidden" name="pageNum" th:value="${classInforPageInfos.pageSize}" id="pageNum"/>
					<button type="submit" th:onclick="|page(1)|"   class="btn btn-primary">搜索</button>
				</form>

			</div>

			<!--数据展示区-->
			<div class="myPost_Theme" style="height: 80vh;margin-top: 50px;">
				<table width="100%" border="0" cellspacing="0" cellpadding="0" class="myPost_Table">
					<tr class="myPost_Th">
						<th><input type="checkbox"  id="checkAll"  /></th>
						<th>课程名称</th>
						<th>课程分类</th>
						<th>讲师</th>
						<th>开始日期</th>
						<th>上课时间</th>
					</tr>
					<tr th:each="c,l:${classInforPageInfos.list}">
						<td><input type="checkbox"  th:id="'box_'+${l.index}" th:value="${c.classId}"/></td>
						<td>
							<a style="color: red;" th:href="@{../toClassDetails(classId=${c.classId},teacher_id=${c.teacher.teacher_id})}">[[${c.classTitle}]]</a>
						</td>
						
						<td>[[${c.classType}]]</td>
						<td th:text="${c.teacher.user_name}">alex</td>
						<td>[[${#dates.format(c.startDate,'yyyy-MM-dd')}]]</td>
						<td>[[${#dates.format(c.startTime,'HH:mm')}]]--[[${#dates.format(c.endTime,'HH:mm')}]]</td>
					</tr>

				</table>

				<!--分页区-->
				<div class="pageList" style="width: 500px;float: right;">
					<ul>
						<li th:each="a:${classInforPageInfos.navigatepageNums}">
							<a th:onclick="|page(${a})|">[[${a}]]</a>
						</li>
						<li>
							<a th:onclick="|page(${classInforPageInfos.navigateLastPage})|">最后一页</a>
						</li>
						<li th:if="${classInforPageInfos.isLastPage}">
							<a th:onclick="|page(${classInforPageInfos.prePage})|" class="pret">上一页</a>
						</li>
						<li th:if="${classInforPageInfos.isFirstPage}">
							<a th:onclick="|page(${classInforPageInfos.nextPage})|" class="next">下一页</a>
						</li>
					</ul>
				</div>

				<div id="" class="" style="margin-top: 40px;width: 400px; float: left;">
					<input id="close" class="btn btn-success" type="button"  value="关闭"/>
					<input id="getok" class="btn btn-primary" type="button" value="恢复"/>
					<input id="delete" class="btn btn-danger" type="button" value="删除"/>
				</div>
			</div>

		</div>

		<!--表单元素-->
		
		<!-- 代码结束 -->
	</body>

</html>